home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
language
/
parallax
/
maspar_d.tar
/
maspar_dec
/
pz2mpl-dpu.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-14
|
11KB
|
342 lines
/**********************************************************************
*** ***
*** PARZ-Library for MasPar MPL ***
*** ***
*** (c) by University Stuttgart, Germany, 1991, 1992 ***
*** ***
*** Don't edit this file !!! ***
*** ***
*********************************************************************/
#ifndef PZ2MPLDPUH
#define PZ2MPLDPUH
#include <stdio.h>
#include <math.h>
#include <mpl.h>
#include <time.h>
#include <maspar/mp_time.h>
#include <maspar/mp_libc.h>
/********************* DEFINES **************************************/
#define SINGLE 0
#define DOUBLE 1
#if 0
#define PRECISION DOUBLE
#endif
#define PINT plural INT
#define PCHAR plural CHAR
#define PREAL plural REAL
#define PBOOL plural BOOL
#define isActive() (actPE[i])
#define Eval(a) callIt|=(int)globalor((plural int)(activePE[i]=(activePE[i]&126)|(isActive()?(a):0))&(plural char)1);\
actPE[i]=((plural short)activePE[i])&(plural short)1
#define ForAllPE for(i=0;i<PEMAX;i++) if (((plural int) InitialActSet [i]) & (plural int) 1)
#define ForAllActivePE for(i=0;i<PEMAX;i++) if (isActive ())
#define NO_REDUCE 0
#define MIN_REDUCE 1
#define MAX_REDUCE 2
#define SUM_REDUCE 3
#define MUL_REDUCE 4
#define AND_REDUCE 5
#define OR_REDUCE 6
#define FIRST_REDUCE 7
#define LAST_REDUCE 8
#define OWN_REDUCE 9
/********************* TYPES *****************************************/
typedef long INT;
typedef unsigned char CHAR;
#if PRECISION == DOUBLE
typedef double REAL;
#else
typedef float REAL;
#endif
typedef long BOOL;
typedef union {
INT i;
CHAR c;
BOOL b;
REAL r;
} MemItem;
typedef plural union {
INT i;
CHAR c;
BOOL b;
REAL r;
} PMemItem;
typedef PMemItem *plural PMemPtr;
typedef struct {
PMemItem *vector;
int vecSize;
int indIndex;
struct timeval startTime;
} VACTRECORD;
/************************** VARIABLES *******************************/
/*** predeclared variables ***/
extern MemItem _dpuTERMCH;
extern MemItem _dpuACTTRANS;
extern MemItem _dpuMAXTRANS;
extern PMemItem *_VRESULT;
extern PMemItem *_ID;
/*** input / output ***/
extern FILE *in, *out;
extern void OpenInput (), OpenInputChars (), CloseInput ();
extern void OpenOutput (), OpenOutputChars (), CloseOutput ();
/*** maintenance ***/
extern struct timezone timeZone;
extern plural char *activePE, *InitialActSet;
extern plural short *actPE;
extern PMemItem *VDisp [];
extern PMemPtr *plural VIndDisp;
extern int IndIndex, *IndSizeDisp;
extern INT outPortTmp, inPortTmp;
extern int callIt;
extern PMemItem *vTmp, *vTmp2;
extern MemItem _tmpItem1, _tmpItem2, _tmpItem3;
/*************************** FUNCTIONS ******************************/
/*** maintenance ***/
extern void InitVDisplay (), ResetVDisplay ();
extern void SetVDisplay (int level, VACTRECORD *buf,
PMemItem *vTo, int vectorSize);
extern void SetAct (plural char str, int indx);
extern void VSetSet (PMemItem *plural arrayStart,
int start,
int ende,
char *str);
extern void SetPos (int *startPtr, int startValue, int length);
extern plural INT NewVMem (int size);
extern PMemItem *plural VRef (plural INT refIndex);
extern void DPUPrintTime (struct timeval *startTime,
char *procName),
DPUStartTime (struct timeval *begin);
extern void INIT_DPU (int argc,
char *argv [],
int NumOfPEs,
int NumOfPorts,
int globalVecSize,
PMemItem *vecAdr,
int hasNew,
char *progName,
int xnetUse,
int xDim,
int yDim,
int Recording);
extern int EXIT (int returnCode);
extern void EmitRecording (char statementTyp);
extern void IncStatCounter ();
extern char *New (int amount);
/*** stack ***/
extern void PUSHVi (int indx, plural INT val),
PUSHVr (int indx, plural REAL val),
PUSHVc (int indx, plural CHAR val),
PUSHVb (int indx, plural BOOL val);
extern PINT POPVi (int indx);
extern PREAL POPVr (int indx);
extern PBOOL POPVb (int indx);
extern PCHAR POPVc (int indx);
/*** control statements ***/
extern void PushActSet (), PopActSet ();
/*** math ***/
extern plural INT VRandomI ();
extern plural CHAR VRandomC ();
extern plural INT VRandomB ();
extern plural REAL VRandomR ();
extern plural INT _VMOD (plural INT lhs, plural INT rhs),
Vabs (plural INT val);
extern plural INT _VIPOWER (plural INT base, plural INT exp);
extern plural REAL _VRIPOWER (plural REAL rb, plural INT ie),
_VRRPOWER (plural REAL base, plural REAL exp);
/*** input / output ***/
extern plural BOOL VInBool ();
extern void VInChars (plural CHAR *plural var, INT maxLen);
extern plural INT VInInt ();
extern plural REAL VInReal ();
extern void VOutInt (plural INT val, int len);
extern void VOutReal (plural REAL val, int len, int prec);
extern void VOutChars (plural CHAR *buf,
INT min);
extern void VOutBool (plural BOOL buf);
/*** strings ***/
extern void _VStrCopy (plural CHAR *str1, char *str2);
extern plural INT _VStrCmpCon (plural CHAR *str1, char *str2);
extern plural INT _VStrCmp (plural CHAR *str1, plural CHAR *str2);
/*** reduction ***/
/*** reduce variable ***/
extern void GenProp_ (INT outPort,
INT inPort,
int reduceCode,
void (*reduceLabel) (),
int OutAll,
int InAll),
_GenProp ();
extern void GenPropI (int indx, plural INT *to, plural INT from),
GenPropR (int indx,
plural REAL *to,
plural REAL from),
GenPropC (int indx, plural CHAR *to, plural CHAR from),
GenPropB (int indx,
plural BOOL *to,
plural BOOL from);
extern void RedSumI (plural INT var), RedMulI (plural INT var);
extern void RedSumR (plural REAL var), RedMulR (plural REAL var);
extern void RedMaxI (plural INT var), RedMinI (plural INT var);
extern void RedMaxR (plural REAL var), RedMinR (plural REAL var);
extern void RedMaxC (plural CHAR var), RedMinC (plural CHAR var);
extern void RedMaxB (plural BOOL var), RedMinB (plural BOOL var);
extern void RedAndB (plural BOOL var), RedOrB (plural BOOL var);
extern void RedFirstI (plural INT var), RedLastI (plural INT var);
extern void RedFirstR (plural REAL var), RedLastR (plural REAL var);
extern void RedFirstC (plural CHAR var), RedLastC (plural CHAR var);
extern void RedFirstB (plural BOOL var), RedLastB (plural BOOL var);
extern void Red_ ();
extern INT _RedI ();
extern REAL _RedR ();
extern CHAR _RedC ();
extern BOOL _RedB ();
extern void OwnRedI (int indx, plural INT val),
OwnRedR ( int indx, plural REAL val);
extern void OwnRedC ( int indx, plural CHAR val),
OwnRedB ( int indx, plural BOOL val);
extern void OwnRed ();
extern INT _OwnRedI (void (*reduceLabel) ());
extern REAL _OwnRedR (void (*reduceLabel) ());
extern CHAR _OwnRedC (void (*reduceLabel) ());
extern BOOL _OwnRedB (void (*reduceLabel) ());
/*** propagate reduce ***/
extern void PRedSumI (PMemItem *source,
plural INT **target),
PRedMulI (PMemItem *source,
plural INT **target);
extern void PRedSumR (PMemItem *source,
plural REAL **target),
PRedMulR (PMemItem *source,
plural REAL **target);
extern void PRedMaxI (PMemItem *source,
plural INT **target), PRedMinI (PMemItem *source,
plural INT **target);
extern void PRedMaxR (PMemItem *source,
plural REAL **target), PRedMinR (PMemItem *source,
plural REAL **target);
extern void PRedMaxC (PMemItem *source,
plural CHAR **target), PRedMinC (PMemItem *source,
plural CHAR **target);
extern void PRedMaxB (PMemItem *source,
plural INT **target), PRedMinB (PMemItem *source,
plural INT **target);
extern void PRedAndB (PMemItem *source,
plural INT **target), PRedOrB (PMemItem *source,
plural INT **target);
extern void PRedFirstI (PMemItem *source,
plural INT **target), PRedLastI (PMemItem *source,
plural INT **target);
extern void PRedFirstR (PMemItem *source,
plural REAL **target), PRedLastR (PMemItem *source,
plural REAL **target);
extern void PRedFirstC (PMemItem *source,
plural CHAR **target), PRedLastC (PMemItem *source,
plural CHAR **target);
extern void PRedFirstB (PMemItem *source,
plural INT **target), PRedLastB (PMemItem *source,
plural INT **target);
/*** data transfer ***/
extern void Connect_ (INT fromPort, INT toPort),
Connect (int indx, plural INT toPE);
extern void Biconnect_ (INT fromPort, INT toPort),
Biconnect (int indx, plural INT toPE);
extern void Disconnect (INT fromPort), DisconnectAll ();
extern void ConnectIn_ (INT inPort), _ConnectIn ();
extern void ConnectInOut_ (INT inPort, INT outPort), _ConnectInOut ();
extern plural BOOL ConnectedIn (int indx), ConnectedInOut (int indx);
extern plural BOOL ConnectedOut (int indx, INT outPort),
ConnectedOutIn (int indx, INT outPort, INT inPort);
extern int _LOAD (plural char *plural to,
plural char *from,
int size), _STORE (plural char *to,
plural char *plural from,
int size), _LOAD_PE (int pe,
PMemItem *plural to,
MemItem *from,
int size), _STORE_PE (int pe,
PMemItem *plural to,
MemItem *from,
int size);
extern void _MOVE_VS (PMemItem *plural to,
MemItem *from,
int size), _MOVE_VV (PMemItem *plural to,
PMemItem *plural from,
plural int size);
extern plural BOOL EQUAL_VS (PMemItem *plural vec,
MemItem *sca,
int amount);
/*** graphics *********************************************/
typedef struct colrec { MemItem r, g, b; } COLREC;
#endif
/*** End of pz2mpl-dpu.h ***/